from django.db import models


# Create your models here.

class UserModel02(models.Model):
    username = models.CharField(max_length=30)
    password = models.CharField(max_length=128)
    qx = models.IntegerField(verbose_name='权限')

    class Meta:
        db_table = 'user02'

    def __str__(self):
        return self.username


class CourseModel(models.Model):  # 课程表
    course_name = models.CharField(max_length=30, verbose_name='课程名称')
    course_number = models.IntegerField(default=0,verbose_name='课程数量')
    course_img = models.ImageField(upload_to='static/course_img', verbose_name='课程图片')
    user = models.ForeignKey(UserModel02, on_delete=models.CASCADE)

    class Meta:
        db_table = 'course'

    def __str__(self):
        return self.course_name
